package com.joolun.system.service.impl;

import java.util.HashMap;
import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.joolun.common.corp.TenantContext;
import com.joolun.common.utils.DateUtils;
import com.joolun.system.domain.EduCourse;
import com.joolun.system.domain.vo.EduCourseVo;
import com.joolun.system.mapper.EduCourseMapper;
import com.joolun.system.service.IEduCourseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 招生课程Service业务层处理
 * 
 * @author joolun
 * @date 2025-02-25
 */
@Service
public class EduCourseServiceImpl extends ServiceImpl<EduCourseMapper, EduCourse> implements IEduCourseService
{
    @Autowired
    private EduCourseMapper eduCourseMapper;

    @Override
    public List<EduCourseVo> selectCourseAndTeacherList(String course_type1,String course_type2) {
        HashMap<String,String> map = new HashMap<>();
        map.put("corpId", TenantContext.getTenantId());
        map.put("courseType1", course_type1);
        map.put("courseType2", course_type2);
        return eduCourseMapper.selectCourseAndTeacherList(map);
    }

    /**
     * 查询招生课程
     * 
     * @param courseId 招生课程主键
     * @return 招生课程
     */
    @Override
    public EduCourse selectEduCourseByCourseId(Long courseId)
    {
        return eduCourseMapper.selectEduCourseByCourseId(courseId);
    }

    @Override
    public EduCourse getCourseBySchedulingId(Long schedulingId) {
        return eduCourseMapper.getCourseBySchedulingId(schedulingId);
    }

    /**
     * 查询招生课程列表
     * 
     * @param eduCourse 招生课程
     * @return 招生课程
     */
    @Override
    public List<EduCourse> selectEduCourseList(EduCourse eduCourse)
    {
        // 添加主体id
        eduCourse.setCorpId(TenantContext.getTenantId());
        return eduCourseMapper.selectEduCourseList(eduCourse);
    }

    /**
     * 新增招生课程
     * 
     * @param eduCourse 招生课程
     * @return 结果
     */
    @Override
    public int insertEduCourse(EduCourse eduCourse)
    {
        // 添加主体id
        eduCourse.setCorpId(TenantContext.getTenantId());
        eduCourse.setCreateTime(DateUtils.getNowDate());
        return eduCourseMapper.insertEduCourse(eduCourse);
    }

    /**
     * 修改招生课程
     * 
     * @param eduCourse 招生课程
     * @return 结果
     */
    @Override
    public int updateEduCourse(EduCourse eduCourse)
    {
        eduCourse.setUpdateTime(DateUtils.getNowDate());
        return eduCourseMapper.updateEduCourse(eduCourse);
    }

    /**
     * 批量删除招生课程
     * 
     * @param courseIds 需要删除的招生课程主键
     * @return 结果
     */
    @Override
    public int deleteEduCourseByCourseIds(Long[] courseIds)
    {
        return eduCourseMapper.deleteEduCourseByCourseIds(courseIds);
    }

    /**
     * 删除招生课程信息
     * 
     * @param courseId 招生课程主键
     * @return 结果
     */
    @Override
    public int deleteEduCourseByCourseId(Long courseId)
    {
        return eduCourseMapper.deleteEduCourseByCourseId(courseId);
    }
}
